<template>
	<div class="container">
		<h3>投诉举报</h3>
		<el-row style="margin-top: 20px">
		    <el-col :span="7">
		        <el-input placeholder="请输入关键词" v-model="searchName" style="width: 300px">
		            <i slot="prefix" class="el-input__icon el-icon-search"></i>
		            <el-button slot="append" @click="handleSearch">搜索</el-button>
		        </el-input>
		    </el-col>
		   <!--<el-button type="primary" @click="goadd" style="float: right; margin-right: 10px">新增</el-button>-->
		</el-row>

		<el-table :data="tableData" border ref="multipleTable" header-cell-class-name="table-header" style="margin-top: 20px">
		    <el-table-column prop="headline" sortable label="举报事由"></el-table-column>
		    <el-table-column prop="productName" sortable label="产品名称"></el-table-column>
		    <el-table-column prop="traceCode" sortable label="追溯码"></el-table-column>
			<el-table-column prop="enterprise" sortable label="所属企业"></el-table-column>
			<el-table-column prop="state" sortable label="授权状态"></el-table-column>
		    <el-table-column label="操作" width="150" align="center">
		        <template slot-scope="scope">
		            <el-button  type="text" style="color: #409EFF" @click="handleCheck(scope.row)">查看</el-button>
					<el-button  type="text" style="color: #409EFF" @click="handleReply(scope.row)">回复</el-button>
		        </template>
		    </el-table-column>
		</el-table>
		<el-pagination
		    layout="total, prev, pager, next, jumper"
		    :page-size="pageSize"
		    :current-page.sync="currentPage"
		    @current-change="handleCurrentChange"
		    :total="total"
		    style="margin-top: 20px"
		></el-pagination>
	</div>
</template>

<script>
	import { report_inquire,report_search, report_newUsers } from "@/request/supervisionCenterApi.js"
	export default{
		data(){
			return{
				searchName:'',
				tableData:[
					{
						clientName: '123'
					}
				],
				currentPage: 1,
				pageSize: 10,
				total: 0,
			}
		},
		mounted(){
			this.init()
			// this.init1()
		},
		methods:{
			init() {
				let data = {
					page: this.currentPage,
                    pageSize:this.pageSize,
                    headline: this.searchName
				}
				report_inquire(data).then((res) =>{
					this.tableData =res.rows
					this.total = res.total
				})
				// report_newUsers().then((res) =>{
				// 	console.log(res);
				// })
			},
			// 跳转到回复
			handleReply(row){
				this.$router.push({
                    path: '/supervisionCenter/inform/reply',
					query: {
						id: row.id
					}
                })
			},

			// 跳转到查看
			handleCheck(row){
				this.$router.push({
                    path: '/supervisionCenter/inform/check',
					query: {
						id: row.id
					}
                })
			},

			// 跳转到新增
			goadd(){

			},

			// 搜索
			handleSearch(){
				this.init()
			},

			handleCurrentChange(){
                this.pageSize+1
                this.init()
			}
		}
	}
</script>

<style scoped>
	.el-pagination {
	    text-align: center;
	}
</style>
